// document.write("<h1>这是一个标题</h1>");
// document.write("<p>测试测试</p>");
// var content_remind = document.getElementById('remind_content')
// console.log(content_remind)

// function submit(content_remind){
//     document.write(content_remind);
// }
// 渲染页面
function insertMessage() {
    const content = document.getElementById('remind_content').value
    // document.write(content)
    // console.log(content)

    const fatherDiv = document.createElement("div")
    const random_id = String(Math.random())
    // fatherDiv.id = "father"
    fatherDiv.id = random_id

    const para = document.createElement("p")
    para.id = "append_para"

    const node = document.createTextNode(content)

    const remove_button = document.createElement("input")
    remove_button.id = "buttonForRemove"
    remove_button.type = "submit"
    remove_button.value = "删除"
    remove_button.onclick = removeElement  //卡了一会找不到，原来鼠标点击事件就只写个函数名就行，压根不用引号+括号

    fatherDiv.appendChild(para)
    para.appendChild(node)
    para.appendChild(remove_button)
    
    const element = document.getElementById("first_text")
    element.appendChild(fatherDiv)

    function removeElement(){
        const getid = document.getElementById(random_id)
        const remove_para = document.getElementById("append_para")
        getid.remove(remove_para)
    }
}

// function removeElement(){
//     const getid = document.getElementById("father")
//     const remove_para = document.getElementById("append_para")
//     getid.remove(remove_para)
// }